﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Routing;
using System.Web.Mvc;
using PaymentHelper.Core.Extension;
using PaymentHelper.Core.RelatedObject;
using PaymentHelper.Core;
using PaymentHelper.Core.MVCUtils;

namespace PaymentHelper
{
    public interface IPaymentMethod:IExtension
    {
        #region Properties
        /// <summary>
        /// Gets a value indicating whether capture is supported
        /// </summary>
        bool SupportCapture { get; }

        /// <summary>
        /// Gets a value indicating whether refund is supported
        /// </summary>
        bool SupportRefund {get;}

        /// <summary>
        /// Gets a value indicating whether void is supported
        /// </summary>
        bool SupportVoid { get; }

        /// <summary>
        /// Gets PaymentMethodType
        /// </summary>
        PaymentMethodType PaymentMethodType { get;}

        #endregion

        #region Methods

        /// <summary>
        /// Get fee of handling
        /// </summary>
        /// <returns></returns>
        decimal GetHandlingFee();

        /// <summary>
        /// Get a value indicating whether payment method accept the specified currency
        /// </summary>
        /// <param name="currencyCode">Currency code</param>
        /// <returns>True/False</returns>
        bool AcceptCurrency(string currencyCode);

        /// <summary>
        /// Process a payment request
        /// </summary>
        /// <param name="processPaymentRequest">Information of payment request</param>
        void ProcessPayment(ProcessPaymentRequest processPaymentRequest);

        /// <summary>
        /// Capture method
        /// </summary>
        /// <param name="capturePaymentRequest"></param>
        /// <returns></returns>
        CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest);

        /// <summary>
        /// Refund method
        /// </summary>
        /// <param name="refundPaymentRequest"></param>
        /// <returns></returns>
        RefundPaymentResult Refund(RefundPaymentRequest refundPaymentRequest);

        /// <summary>
        /// Void method
        /// </summary>
        /// <param name="voidPaymentRequest"></param>
        /// <returns></returns>
        VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest);

        /// <summary>
        /// Get type of controller 
        /// </summary>
        /// <returns></returns>
        PaymentHelperController GetControllerType();

        /// <summary>
        /// Get required payment information from user
        /// </summary>
        /// <param name="orderCurrent"> Current order processing </param>
        /// <param name="collection"> Form contains data from user </param>
        void GetPaymentInfo(Order orderCurrent, FormCollection collection);

        #endregion

        #region For MVC

        /// <summary>
        /// Gets a route for provider configuration
        /// </summary>
        /// <param name="actionName">Action name</param>
        /// <param name="controllerName">Controller name</param>
        /// <param name="routeValues">Route values</param>
        void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues);

        /// <summary>
        /// Gets a route for payment info
        /// </summary>
        /// <param name="actionName">Action name</param>
        /// <param name="controllerName">Controller name</param>
        /// <param name="routeValues">Route values</param>
        void GetPaymentInfoRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues);

        void RegisterRoutes(RouteCollection routes);
        
        #endregion
               
    }
}
